home *** CD-ROM | disk | FTP | other *** search
- on setButtonsFromArray
- set whichSection to the frameLabel
- if whichSection = "PDC" then
- setPdcFromArray()
- else
- if whichSection = "breakfast" then
- setBreakfastFromArray()
- else
- if whichSection = "breakfast veg" then
- setBreakfastVegFromArray()
- else
- if whichSection = "brunch" then
- setBrunchFromArray()
- else
- if whichSection = "brunch veg" then
- setBrunchVegFromArray()
- else
- if whichSection = "lunch" then
- setLunchFromArray()
- else
- if whichSection = "lunch veg" then
- setLunchVegFromArray()
- else
- if whichSection = "dinner" then
- setDinnerFromArray()
- else
- if whichSection = "dinner veg" then
- setDinnerVegFromArray()
- else
- if whichSection = "dinner2" then
- setDinner2FromArray()
- else
- if whichSection = "dinner2 veg" then
- setDinner2VegFromArray()
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on setPdcFromArray
- setPDCNoFatFromArray()
- setFatPercentFromArray()
- setPDCFieldsFromArray()
- end
-
- on setPDCFieldsFromArray
- global calcdata
- put string(getaProp(calcdata, #desired_calories)) into field "Calories"
- if getaProp(calcdata, #twoMeals) then
- put 2 into field "meals"
- else
- put 3 into field "meals"
- end if
- end
-
- on setPDCNoFatFromArray
- global calcdata
- set btnNames to "diabetes,heart,preg,hypr,vegt,under_19,low_fat,none"
- set setOneGreen to 0
- repeat with x = 1 to 8
- set theValue to getAt(calcdata, x)
- puppetSprite(x + 7, 1)
- if theValue then
- set the castNum of sprite (x + 7) to the number of cast ("green_" & item x of btnNames)
- set setOneGreen to 1
- else
- set the castNum of sprite (x + 7) to the number of cast ("red_" & item x of btnNames)
- end if
- if x = 7 then
- puppetSprite(45, 1)
- set the visible of sprite 45 to theValue
- puppetSprite(46, 1)
- set the visible of sprite 46 to theValue
- puppetSprite(47, 1)
- set the visible of sprite 47 to theValue
- puppetSprite(48, 1)
- set the visible of sprite 48 to theValue
- setFatPercentFromArray()
- end if
- end repeat
- if not setOneGreen then
- setaProp(calcdata, #none, 1)
- set the castNum of sprite 15 to the number of cast "green_none"
- end if
- end
-
- on setFatPercentFromArray
- global calcdata
- if the visible of sprite 16 then
- set theValue to getaProp(calcdata, #fat_percent)
- repeat with x = 1 to 3
- puppetSprite(x + 45, 1)
- if theValue = x then
- set the castNum of sprite (x + 45) to the number of cast ("green_fat_" & x)
- next repeat
- end if
- set the castNum of sprite (x + 45) to the number of cast ("red_fat_" & x)
- end repeat
- end if
- end
-
- on setLunchVegFromArray
- setLunchFromArray()
- end
-
- on setLunchFromArray
- setLunchGroup1FromArray()
- setLunchGroup2FromArray()
- setLunchGroup3FromArray()
- setLunchGroup4FromArray()
- end
-
- on setLunchGroup1FromArray
- global calcdata
- set btnNames to "lun_meat,lun_pasta,lun_sand"
- repeat with x = 1 to 3
- set isOn to getAt(calcdata, x + 18)
- puppetSprite(x + 13, 1)
- if isOn then
- set the castNum of sprite (x + 13) to the number of cast ("green_" & item x of btnNames)
- next repeat
- end if
- set the castNum of sprite (x + 13) to the number of cast ("red_" & item x of btnNames)
- end repeat
- end
-
- on setLunchGroup2FromArray
- global calcdata
- set isSoup to getaProp(calcdata, #lun_soup)
- puppetSprite(17, 1)
- puppetSprite(18, 1)
- if isSoup then
- set the castNum of sprite 17 to the number of cast "green_lun_soup"
- set the castNum of sprite 18 to the number of cast "red_lun_salad"
- else
- set the castNum of sprite 17 to the number of cast "red_lun_soup"
- set the castNum of sprite 18 to the number of cast "green_lun_salad"
- end if
- end
-
- on setLunchGroup3FromArray
- global calcdata
- set isFruit to getaProp(calcdata, #lun_fruit)
- puppetSprite(19, 1)
- puppetSprite(20, 1)
- if isFruit then
- set the castNum of sprite 19 to the number of cast "green_lun_fruit"
- set the castNum of sprite 20 to the number of cast "red_lun_juice"
- else
- set the castNum of sprite 19 to the number of cast "red_lun_fruit"
- set the castNum of sprite 20 to the number of cast "green_lun_juice"
- end if
- end
-
- on setLunchGroup4FromArray
- global calcdata
- set isMilk to getaProp(calcdata, #lun_milk)
- puppetSprite(21, 1)
- puppetSprite(22, 1)
- if isMilk then
- set the castNum of sprite 21 to the number of cast "green_lun_milk"
- set the castNum of sprite 22 to the number of cast "red_lun_cheese"
- else
- set the castNum of sprite 21 to the number of cast "red_lun_milk"
- set the castNum of sprite 22 to the number of cast "green_lun_cheese"
- end if
- end
-
- on setBrunchFromArray
- setBreakfastFromArray()
- end
-
- on setBrunchVegFromArray
- setBreakfastVegFromArray()
- end
-
- on setBreakfastFromArray
- setBreakfastGroup1FromArray()
- setBreakfastGroup2FromArray()
- end
-
- on setBreakfastVegFromArray
- setBreakfastFromArray()
- end
-
- on setBreakfastGroup1FromArray
- global calcdata
- set btnNames to "brk_eggs,brk_meat,brk_pancakes,brk_cereal,brk_potatoes"
- repeat with x = 1 to 5
- set theValue to getAt(calcdata, x + 11)
- puppetSprite(x + 17, 1)
- if theValue then
- set the castNum of sprite (x + 17) to the number of cast ("green_" & item x of btnNames)
- next repeat
- end if
- set the castNum of sprite (x + 17) to the number of cast ("red_" & item x of btnNames)
- end repeat
- end
-
- on setBreakfastGroup2FromArray
- global calcdata
- set isFruit to getaProp(calcdata, #brk_fruit)
- puppetSprite(23, 1)
- puppetSprite(24, 1)
- if isFruit then
- set the castNum of sprite 23 to the number of cast "green_brk_fruit"
- set the castNum of sprite 24 to the number of cast "red_brk_juice"
- else
- set the castNum of sprite 23 to the number of cast "red_brk_fruit"
- set the castNum of sprite 24 to the number of cast "green_brk_juice"
- end if
- end
-
- on setDinner2FromArray
- setLunchGroup1FromArray()
- setDinnerGroup2FromArray()
- setDinnerGroup3FromArray()
- setLunchGroup4FromArray()
- setDinnerGroup4FromArray()
- end
-
- on setDinner2VegFromArray
- setDinner2FromArray()
- end
-
- on setDinnerFromArray
- setDinnerGroup1FromArray()
- setDinnerGroup2FromArray()
- setDinnerGroup3FromArray()
- setDinnerGroup4FromArray()
- end
-
- on setDinnerVegFromArray
- setDinnerFromArray()
- end
-
- on setDinnerGroup1FromArray
- global calcdata
- set isMeat to getaProp(calcdata, #din_meat)
- puppetSprite(12, 1)
- puppetSprite(13, 1)
- if isMeat then
- set the castNum of sprite 12 to the number of cast "green_din_meat"
- set the castNum of sprite 13 to the number of cast "red_din_pasta"
- else
- set the castNum of sprite 12 to the number of cast "red_din_meat"
- set the castNum of sprite 13 to the number of cast "green_din_pasta"
- end if
- end
-
- on setDinnerGroup2FromArray
- global calcdata
- set isBread to getaProp(calcdata, #din_bread)
- puppetSprite(17, 1)
- puppetSprite(18, 1)
- if isBread then
- set the castNum of sprite 17 to the number of cast "green_din_bread"
- set the castNum of sprite 18 to the number of cast "red_din_potatoes"
- else
- set the castNum of sprite 17 to the number of cast "red_din_bread"
- set the castNum of sprite 18 to the number of cast "green_din_potatoes"
- end if
- end
-
- on setDinnerGroup3FromArray
- global calcdata
- set isBread to getaProp(calcdata, #din_soup)
- puppetSprite(19, 1)
- puppetSprite(20, 1)
- if isBread then
- set the castNum of sprite 19 to the number of cast "green_din_soup"
- set the castNum of sprite 20 to the number of cast "red_din_salad"
- else
- set the castNum of sprite 19 to the number of cast "red_din_soup"
- set the castNum of sprite 20 to the number of cast "green_din_salad"
- end if
- end
-
- on setDinnerGroup4FromArray
- global calcdata
- puppetSprite(23, 1)
- if getaProp(calcdata, #din_dessert) then
- set the castNum of sprite 23 to the number of cast "green_din_dessert"
- else
- set the castNum of sprite 23 to the number of cast "red_din_dessert"
- end if
- end
-